package educationaladministrationsystem.CSM.Mapper.Root;

import educationaladministrationsystem.Class.Faculties;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RootFacultiesMapper {
    @Insert("insert into Faculties values (#{faculties.id},#{faculties.name},#{faculties.studentSum},#{faculties.teacherSum},#{faculties.headOfDepartment},#{faculties.phone},#{now})")
    Integer addNewFaculties(Faculties faculties, String now);

    @Select("select * from Faculties limit #{page},#{pageSum}")
    List<Faculties> getFacultiesInformation(int page, int pageSum);

    @Update("update faculties set id=#{faculties.id},name=#{faculties.name},headOfDepartment=#{faculties.headOfDepartment},phone=#{faculties.phone} where id=#{oldFacultiesId}")
    Integer updateFacultiesInformation(Faculties faculties, String oldFacultiesId);

    @Delete("delete from faculties where id=#{deleteId}")
    Integer deleteInformation(int deleteId);

    @Select("select count(*) from faculties")
    Integer getAllPage();
}
